package com.aaa.vip.controller;

import com.aaa.common.entity.About;
import com.aaa.common.util.BaseUtil;
import com.aaa.common.util.Result;
import com.aaa.common.vo.Page;
import com.aaa.vip.service.AboutService;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 关于表(About)表控制层
 *
 * @author makejava
 * @since 2025-09-19 18:11:16
 */
@RestController
@RequestMapping("about")
@Log4j2
public class AboutController {
    /**
     * 服务对象
     */
    @Resource
    private AboutService aboutService;

    /**
     * 分页查询
     *
     * @param page 分页对象
     * @return 查询结果
     */
    @PostMapping("queryByPage")
    public Result queryByPage(@RequestBody Page<About> page) {
        return BaseUtil.success(this.aboutService.queryByPage(page));
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("queryById")
    public Result queryById(Integer id) {
        return BaseUtil.success(this.aboutService.queryById(id));
    }

    /**
     * 新增数据
     *
     * @param about 实体
     * @return 新增结果
     */
    @PostMapping("add")
    public Result add(@RequestBody About about) {
        return BaseUtil.success(this.aboutService.insert(about));
    }

    /**
     * 编辑数据
     *
     * @param about 实体
     * @return 编辑结果
     */
    @PostMapping("edit")
    public Result edit(@RequestBody About about) {
        return BaseUtil.success(this.aboutService.update(about));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping("deleteById")
    public Result deleteById(Integer id) {
        return BaseUtil.success(this.aboutService.deleteById(id));
    }

}

